﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace Password_Generator
{
    class ValidationRules : ValidationRule
    {
        public ValidationRules()
        {

        }
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {

            int test = 0;

            if (!Int32.TryParse(value.ToString(), out test))
                return new ValidationResult(false, "!");
            if (test < 3)
                return new ValidationResult(false, "!");
            if (test > 20)
                return new ValidationResult(false, "!");
            return ValidationResult.ValidResult;
        }

    }
}
